package com.design.util.moveBox;

public class Next {
    private final int[] direction;
    private int x;
    private int y;
    public Next(int[] direction,int x,int y){
        this.direction = direction;
        this.x = x;
        this.y = y;
    }
    public Next run(){
        this.x += direction[0];
        this.y += direction[1];
        return this;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }
    public static int[] switchDirection(char key){
         switch (key) {
            case 'd' : return new int[]{1, 0};
            case 'a' : return new int[]{-1, 0};
            case 'w' : return new int[]{0, -1};
            case 's' : return  new int[]{0, 1};
            default : return null;
        }
    }
}
